85807cc63f26e42f04b5beec235f336a1d37a489,app/src/main/java/com/kyletung/doubanbookmovie/search/SearchFragment.java,SearchFragment,onCreateView,#LayoutInflater#ViewGroup#Bundle#,38
Before Change
tabLayout = (TabLayout) view.findViewById(R.id.fragment_search_tablayout);
tabLayout.setTabMode(TabLayout.MODE_FIXED);
//fix tablayout no title bug
if (ViewCompat.isLaidOut(tabLayout)) {
tabLayout.setupWithViewPager(viewPager);
} else {
tabLayout.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
@Override
public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
tabLayout.setupWithViewPager(viewPager);
tabLayout.removeOnLayoutChangeListener(this);
}
});
}
//init edit text and search button
After Change
tabLayout = (TabLayout) view.findViewById(R.id.fragment_search_tablayout);
tabLayout.setTabMode(TabLayout.MODE_FIXED);
//fix tablayout no title bug
tabLayout.post(new Runnable() {
@Override
public void run() {
tabLayout.setupWithViewPager(viewPager);
}
});
//init edit text and search button
input = (EditText) view.findViewById(R.id.fragment_search_text);